package com.kingwood.algorithm.test;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

/**
 * @Author 22025812
 * @Description: 最长的指定瑕疵度的元音子串
 * https://fcqian.blog.csdn.net/article/details/127711201
 * @Date: 2024/3/27 14:08
 * @Modified By：
 * @Version 1.0
 */

public class YuanYinSubstr {

    public static int getResult(int flaw, String str) {
        char[] yuan = {'a', 'o', 'e', 'i', 'u','A', 'O', 'E', 'I', 'U'};
        HashSet<Character> set = new HashSet<>();
        for (char c : yuan) {
            set.add(c);
        }

        ArrayList<Integer> idx = new ArrayList<>();
        for (int i = 0; i < str.length(); i++) {
            if (set.contains(str.charAt(i))) {
                idx.add(i);
            }
        }

        int ans = 0;
        int n = idx.size();
        int l = 0, r = 0;

        while (r < n) {
            // 两者之间的差值，再减去里面包含的原因字符的数量，就是当前的瑕疵度
            int diff = idx.get(r) - idx.get(l) - (r - l);
            if (diff > flaw) {
                l++;
            } else if (diff < flaw){
                r++;
            } else {
                ans = Math.max(ans, idx.get(r) - idx.get(l) + 1);
                r++;
            }
        }

        return ans;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = Integer.parseInt(scanner.nextLine());
        String s = scanner.nextLine();
        System.out.println(getResult(k, s));
    }
}
